/**
* @File           :   api.go
* @Time           :   2022/05/09
* @Author         :   Mz100
* @Description    :   api main
 */

package main

import (
	"xdingtec.cn/xdkaika/app"
	"xdingtec.cn/xdkaika/initializers"
	"xdingtec.cn/xdkaika/routers"
)

func main() {
	app.VIPER = initializers.Viper()
	app.DB = initializers.GormMysql()
	app.REDIS = initializers.Redis()
	r := routers.ApiRouter()
	// 延迟关闭数据库
	if app.DB != nil {
		db, _ := app.DB.DB()
		defer db.Close()
	}

	_ = r.Run()
}
